var token = localStorage.getItem('tok');
//线下还款页面
$.ajax({
    type: "GET",
    url: $host+'/api/app/return/returnInfo',
    async: true,
    dataType:'json',
    data:{
        'token':token
    },
    success: function(result){
        console.log(result);
    },
    error:function(){
        console.log('接口错误')
    }
});
$('.show_btn').click(function(){
    if(!token){
        window.location.href = 'dengluy.html?url=xianxiahk'
    }
    $('.schedule_1').hide();
    $('.schedule_2').show();
})
//上传凭证
// var hkje=$('.hkjee').val();//还款金额
// var hkrq=$('.hkrq').val();//还款日期
var img="";
$('.sc_btn').click(function(){
    $.ajax({
        type: "POST",
        url: $host+'/api/app/return/offLinePay',
        async: true,
        dataType:'json',
        data:{
            'token':token,
           'imgs':img
        },
        success: function(result){
            console.log(result);
            if(result.status===900000){
                layer.msg('上传成功')
            }
        },
        error:function(){
            console.log('接口错误')
        }
    });
})
//绑定文件上传
$('.upfile').bind('click',function () {
    $('.upImg').trigger('click')
});
$('.upImg').on('change',function () {
    $.ajax({
        url:$host+ "/api/upload/imgs",
        type: 'POST',
        cache: false,
        data: new FormData($('#infoLogoForm')[0]),
        processData: false,
        contentType: false,
        dataType:"json",
        beforeSend: function(){
        },
        success : function(res) {
            if(res.data.address){
                img=res.data.address;
                $('.upfile').empty().css('background','url('+res.data.address+')no-repeat center/100% 100%')
            }
        }
    });
})
//
var calendar = new lCalendar();
calendar.init({
    'trigger': '#demo1',
    'type': 'date'
});
//点击返回
$('.xxhkfh').click(function(){
    window.location.href="woyaohk.html";
})


